const qs = require('qs')
const dateFormat = require('../../../../src/utils/dateFormat')
const ERR_CODE = 0
let ID = 1

const customer = {
	customerName: '哔哩哔哩无限矿业公司',
	empAdd: 5,
	supAdd: 10,
	uninsure: 3,
	cancel: 3
}

module.exports = function registerCustomer(app) {
	app.post('/api/admin/scan/customerList', (req, res) => {
		const { limit } = qs.parse(req.query)
		const list = []
		for (var i = 0; i < Number(limit); i++) {
			list.push({
				...customer,
				customerId: ID++
			})
		}
		setTimeout(() => {
			res.json({
				code: ERR_CODE,
				data: {
					list,
					total: 100
				}
			})
		}, 3000)
	})
}
